package com.demo;

import com.demo.component.AComponent;
import com.demo.component.StudentBeans;
import com.demo.model.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

class MyArray<T> {
    public T[] array = (T[]) new Object[10];

    public T getPos(int pos) {
        return this.array[pos];
    }

    public void setVal(int pos, T val) {
        this.array[pos]=val;
    }
    public T[] getArray() {
        return array;
    }
}
public class App3 {
    static class MyRunnable implements Runnable{
        @Override
        public void run() {
            System.out.println("myThread");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main3(String[] args) {
        ApplicationContext context=new ClassPathXmlApplicationContext("spring-config.xml");
        Student student1 =(Student)context.getBean("student1");
        System.out.println(student1);
//        StudentBeans studentBeans = context.getBean("studentBeans", StudentBeans.class);
//        System.out.println(studentBeans);
    }
    public static void main2(String[] args) throws InterruptedException {
        Runnable runnable=new MyRunnable();
        Thread t=new Thread(runnable);
        t.start();
        while (true){
            System.out.println("hello main");
            Thread.sleep(1000);
        }
    }
    public static void main(String[] args) {
        ApplicationContext context=new ClassPathXmlApplicationContext("spring-config.xml");
        AComponent aComponent = context.getBean("AComponent", AComponent.class);

    }
}
